package com.jdz.gxq.info.admin.training.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.jdz.gxq.info.admin.training.bo.Training;
import com.jdz.gxq.info.admin.training.form.EditTrainingForm;
import com.jdz.gxq.info.admin.training.service.TrainingService;
import com.jdz.gxq.info.common.action.CommonAction;

public class EditTrainingAction extends CommonAction {

	private TrainingService trainingService = null;
	 
	public ActionForward doExecute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws java.lang.Exception {
		
		EditTrainingForm editTrainingForm = (EditTrainingForm) form;
	
		Training training = trainingService.getTrainingById(editTrainingForm.getId());
		
		editTrainingForm.setTraining(training);

		return mapping.findForward("success");
	}

	public void setTrainingService(TrainingService trainingService) {
		this.trainingService = trainingService;
	}
}

